 /* ManutencaoDeUsuarios.java
 *
 * Created on 08/11/2011, 10:37:19
 */
package scc.Telas;

import java.awt.Color;
import java.io.*;
import java.sql.SQLException;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileNameExtensionFilter;
import scc.Dao.UserDAO;
import scc.Entidade.Membro;
import scc.Entidade.Usuario;
import scc.utils.ValidaCPF;

/**
 *
 * @author Davidson
 */
public class FrmCadastrarMembros extends javax.swing.JInternalFrame {

    private static FrmCadastrarMembros telaCaixa;
    private static Usuario usuario;
    private static UserDAO dao;
    File fileOrigem;
    
    /** Creates new form ManutencaoDeUsuarios */
    private FrmCadastrarMembros() throws SQLException, ParseException {
        initComponents();        
        //lblUsuario.setText(usuario.getNome());        
        this.setVisible(true);
        this.moveToFront();        
        //txtNumeroCadastro.setText(new Integer(dao.proximoNumeroCadastro()).toString());
        carregarListaIgrejas();
        carregarListaMembros();
        habilitaCampos(false);
    }
    
    public static FrmCadastrarMembros getInstancia(UserDAO dao2, Usuario usuario2) throws SQLException, ParseException{
        if (telaCaixa == null) {
            dao = dao2;
            usuario = usuario2;
            telaCaixa = new FrmCadastrarMembros();
        }
        return telaCaixa;
    }
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup1 = new javax.swing.ButtonGroup();
        pPesquisa = new javax.swing.JPanel();
        lblPesquisaCadastro = new javax.swing.JLabel();
        cbCadastro = new javax.swing.JComboBox();
        btConsultar = new javax.swing.JButton();
        btEditar = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        lblNome = new javax.swing.JLabel();
        txtNome = new javax.swing.JTextField();
        lblNomeMae = new javax.swing.JLabel();
        txtNomeMae = new javax.swing.JTextField();
        lblNomePai = new javax.swing.JLabel();
        txtNomePai = new javax.swing.JTextField();
        txtNacionalidade = new javax.swing.JTextField();
        lblNacionalidade = new javax.swing.JLabel();
        txtNumeroCadastro = new javax.swing.JTextField();
        lblNumeroCadastro = new javax.swing.JLabel();
        lblNaturalidade = new javax.swing.JLabel();
        txtNaturalidade = new javax.swing.JTextField();
        lblDataNascimento = new javax.swing.JLabel();
        txtDataNascimento = new javax.swing.JTextField();
        try{
            javax.swing.text.MaskFormatter data= new javax.swing.text.MaskFormatter("##/##/####");
            data.setValidCharacters("0123456789");
            txtDataNascimento = new javax.swing.JFormattedTextField(data);
        }
        catch (Exception e){
        }
        lblEstadoCivil = new javax.swing.JLabel();
        cbEstadoCivil = new javax.swing.JComboBox();
        lblProfissao = new javax.swing.JLabel();
        txtProfissao = new javax.swing.JTextField();
        lblIdentidade = new javax.swing.JLabel();
        txtIdentidade = new javax.swing.JTextField();
        txtCpf = new javax.swing.JTextField();
        try {
            javax.swing.text.MaskFormatter cpf = new javax.swing.text.MaskFormatter("###.###.###-##");
            cpf.setValidCharacters("0123456789");
            txtCpf = new javax.swing.JFormattedTextField(cpf);
        }
        catch (Exception e){
        }
        lblCpf = new javax.swing.JLabel();
        pDados = new javax.swing.JPanel();
        txtMunicipio = new javax.swing.JTextField();
        lblMunicipio = new javax.swing.JLabel();
        lblLogradouro = new javax.swing.JLabel();
        txtLogradouro = new javax.swing.JTextField();
        lblNumero = new javax.swing.JLabel();
        txtNumero = new javax.swing.JTextField();
        txtComplemento = new javax.swing.JTextField();
        lblComplemento = new javax.swing.JLabel();
        txtBairro = new javax.swing.JTextField();
        lblBairro = new javax.swing.JLabel();
        txtEstado = new javax.swing.JTextField();
        lblEstado = new javax.swing.JLabel();
        lblCep = new javax.swing.JLabel();
        txtCep = new javax.swing.JTextField();
        txtTelResidencia = new javax.swing.JTextField();
        lblTelResidencia = new javax.swing.JLabel();
        txtTelCelular = new javax.swing.JTextField();
        lblTelCelular = new javax.swing.JLabel();
        lblEmail = new javax.swing.JLabel();
        txtEmail = new javax.swing.JTextField();
        lblBatizadoNasAguas = new javax.swing.JLabel();
        rbSim = new javax.swing.JRadioButton();
        rbNao = new javax.swing.JRadioButton();
        lblIgrejaBatismo = new javax.swing.JLabel();
        txtIgrejaBatismo = new javax.swing.JTextField();
        lblDataBatismo = new javax.swing.JLabel();
        txtDataBatismo = new javax.swing.JTextField();
        try{
            javax.swing.text.MaskFormatter data= new javax.swing.text.MaskFormatter("##/##/####");
            data.setValidCharacters("0123456789");
            txtDataBatismo = new javax.swing.JFormattedTextField(data);
        }
        catch (Exception e){
        }
        jPanel2 = new javax.swing.JPanel();
        lblCargoMinisterial = new javax.swing.JLabel();
        rbCargoMinisterialSim = new javax.swing.JRadioButton();
        rbCargoMinisterialNao = new javax.swing.JRadioButton();
        lblIgrejaConsagracao = new javax.swing.JLabel();
        txtIgrejaConsagracao = new javax.swing.JTextField();
        lblCargoUltimaConsagracao = new javax.swing.JLabel();
        txtCargoUltimaConsagracao = new javax.swing.JTextField();
        lblDataConsagracao = new javax.swing.JLabel();
        txtDataConsagracao = new javax.swing.JTextField();
        try{
            javax.swing.text.MaskFormatter data= new javax.swing.text.MaskFormatter("##/##/####");
            data.setValidCharacters("0123456789");
            txtDataConsagracao = new javax.swing.JFormattedTextField(data);
        }
        catch (Exception e){
        }
        lblDataIngresso = new javax.swing.JLabel();
        txtDataIngresso = new javax.swing.JTextField();
        try{
            javax.swing.text.MaskFormatter data= new javax.swing.text.MaskFormatter("##/##/####");
            data.setValidCharacters("0123456789");
            txtDataIngresso = new javax.swing.JFormattedTextField(data);
        }
        catch (Exception e){
        }
        lblCargoAtual = new javax.swing.JLabel();
        txtCargoAtual = new javax.swing.JTextField();
        lblIgrejas = new javax.swing.JLabel();
        cbIgrejas = new javax.swing.JComboBox();
        btCancelar = new javax.swing.JButton();
        btSalvar = new javax.swing.JButton();
        btNovoCadastro = new javax.swing.JButton();
        btAtualizar = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        txtfoto = new javax.swing.JLabel();
        btAlterarFoto = new javax.swing.JButton();

        setBackground(new java.awt.Color(255, 255, 255));
        setClosable(true);
        setMaximizable(true);
        setResizable(true);
        setFrameIcon(null);
        setMaximumSize(new java.awt.Dimension(943, 630));
        setMinimumSize(new java.awt.Dimension(943, 630));
        setPreferredSize(new java.awt.Dimension(943, 630));

        pPesquisa.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Lista", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri", 0, 12), new java.awt.Color(51, 51, 51))); // NOI18N

        lblPesquisaCadastro.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        lblPesquisaCadastro.setForeground(new java.awt.Color(51, 51, 51));
        lblPesquisaCadastro.setText("Cadastro: ");

        cbCadastro.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selecione" }));
        cbCadastro.setMinimumSize(new java.awt.Dimension(237, 25));
        cbCadastro.setPreferredSize(new java.awt.Dimension(237, 25));

        btConsultar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scc/Imagens/consultar.png"))); // NOI18N
        btConsultar.setText("Consultar");
        btConsultar.setMargin(new java.awt.Insets(2, 5, 2, 5));
        btConsultar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btConsultarActionPerformed(evt);
            }
        });

        btEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scc/Imagens/editar.png"))); // NOI18N
        btEditar.setText("Editar");
        btEditar.setEnabled(false);
        btEditar.setMargin(new java.awt.Insets(2, 5, 2, 5));
        btEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btEditarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pPesquisaLayout = new javax.swing.GroupLayout(pPesquisa);
        pPesquisa.setLayout(pPesquisaLayout);
        pPesquisaLayout.setHorizontalGroup(
            pPesquisaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pPesquisaLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblPesquisaCadastro)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(btConsultar)
                .addGap(18, 18, 18)
                .addComponent(btEditar)
                .addContainerGap(373, Short.MAX_VALUE))
        );
        pPesquisaLayout.setVerticalGroup(
            pPesquisaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pPesquisaLayout.createSequentialGroup()
                .addGroup(pPesquisaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblPesquisaCadastro)
                    .addComponent(btConsultar)
                    .addComponent(btEditar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        lblNome.setForeground(new java.awt.Color(51, 51, 51));
        lblNome.setText("Nome completo (sem abreviações)");

        txtNome.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtNome.setForeground(new java.awt.Color(51, 51, 51));
        txtNome.setMinimumSize(new java.awt.Dimension(240, 25));
        txtNome.setNextFocusableComponent(txtNomeMae);
        txtNome.setPreferredSize(new java.awt.Dimension(240, 25));

        lblNomeMae.setForeground(new java.awt.Color(51, 51, 51));
        lblNomeMae.setText("Nome completo da Mãe");

        txtNomeMae.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtNomeMae.setForeground(new java.awt.Color(51, 51, 51));
        txtNomeMae.setMinimumSize(new java.awt.Dimension(240, 25));
        txtNomeMae.setNextFocusableComponent(txtNomePai);
        txtNomeMae.setPreferredSize(new java.awt.Dimension(240, 25));

        lblNomePai.setForeground(new java.awt.Color(51, 51, 51));
        lblNomePai.setText("Nome completo do Pai");

        txtNomePai.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtNomePai.setForeground(new java.awt.Color(51, 51, 51));
        txtNomePai.setMinimumSize(new java.awt.Dimension(240, 25));
        txtNomePai.setNextFocusableComponent(txtNacionalidade);
        txtNomePai.setPreferredSize(new java.awt.Dimension(240, 25));

        txtNacionalidade.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtNacionalidade.setForeground(new java.awt.Color(51, 51, 51));
        txtNacionalidade.setMinimumSize(new java.awt.Dimension(60, 25));
        txtNacionalidade.setNextFocusableComponent(txtNaturalidade);
        txtNacionalidade.setPreferredSize(new java.awt.Dimension(60, 25));

        lblNacionalidade.setForeground(new java.awt.Color(51, 51, 51));
        lblNacionalidade.setText("Nacionalidade");

        txtNumeroCadastro.setBackground(new java.awt.Color(245, 245, 245));
        txtNumeroCadastro.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N
        txtNumeroCadastro.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtNumeroCadastro.setEnabled(false);
        txtNumeroCadastro.setMaximumSize(new java.awt.Dimension(41, 23));
        txtNumeroCadastro.setMinimumSize(new java.awt.Dimension(41, 23));
        txtNumeroCadastro.setPreferredSize(new java.awt.Dimension(41, 23));

        lblNumeroCadastro.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        lblNumeroCadastro.setForeground(new java.awt.Color(51, 51, 51));
        lblNumeroCadastro.setText("Cadastro:");

        lblNaturalidade.setForeground(new java.awt.Color(51, 51, 51));
        lblNaturalidade.setText("Naturalidade");

        txtNaturalidade.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtNaturalidade.setForeground(new java.awt.Color(51, 51, 51));
        txtNaturalidade.setMinimumSize(new java.awt.Dimension(50, 25));
        txtNaturalidade.setNextFocusableComponent(txtDataNascimento);
        txtNaturalidade.setPreferredSize(new java.awt.Dimension(50, 25));

        lblDataNascimento.setForeground(new java.awt.Color(51, 51, 51));
        lblDataNascimento.setText("Dt Nascimento");

        txtDataNascimento.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtDataNascimento.setForeground(new java.awt.Color(51, 51, 51));
        txtDataNascimento.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtDataNascimento.setMaximumSize(new java.awt.Dimension(75, 25));
        txtDataNascimento.setMinimumSize(new java.awt.Dimension(75, 25));
        txtDataNascimento.setNextFocusableComponent(cbEstadoCivil);
        txtDataNascimento.setPreferredSize(new java.awt.Dimension(75, 25));

        lblEstadoCivil.setForeground(new java.awt.Color(51, 51, 51));
        lblEstadoCivil.setText("Estado Civil");

        cbEstadoCivil.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        cbEstadoCivil.setForeground(new java.awt.Color(51, 51, 51));
        cbEstadoCivil.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selecione", "Solteiro(a)", "Casado(a)", "Separado(a)", "Divorciado(a)", "Viúvo(a)" }));
        cbEstadoCivil.setMinimumSize(new java.awt.Dimension(100, 25));
        cbEstadoCivil.setNextFocusableComponent(txtProfissao);
        cbEstadoCivil.setPreferredSize(new java.awt.Dimension(100, 25));

        lblProfissao.setForeground(new java.awt.Color(51, 51, 51));
        lblProfissao.setText("Profissão");

        txtProfissao.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtProfissao.setForeground(new java.awt.Color(51, 51, 51));
        txtProfissao.setMaximumSize(new java.awt.Dimension(240, 25));
        txtProfissao.setMinimumSize(new java.awt.Dimension(240, 25));
        txtProfissao.setNextFocusableComponent(txtIdentidade);
        txtProfissao.setPreferredSize(new java.awt.Dimension(240, 25));

        lblIdentidade.setForeground(new java.awt.Color(51, 51, 51));
        lblIdentidade.setText("Identidade");

        txtIdentidade.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtIdentidade.setForeground(new java.awt.Color(51, 51, 51));
        txtIdentidade.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtIdentidade.setMinimumSize(new java.awt.Dimension(90, 25));
        txtIdentidade.setNextFocusableComponent(txtCpf);
        txtIdentidade.setPreferredSize(new java.awt.Dimension(90, 25));

        txtCpf.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtCpf.setForeground(new java.awt.Color(51, 51, 51));
        txtCpf.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtCpf.setMaximumSize(new java.awt.Dimension(100, 25));
        txtCpf.setMinimumSize(new java.awt.Dimension(100, 25));
        txtCpf.setNextFocusableComponent(txtLogradouro);
        txtCpf.setPreferredSize(new java.awt.Dimension(100, 25));
        txtCpf.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtCpfFocusLost(evt);
            }
        });

        lblCpf.setForeground(new java.awt.Color(51, 51, 51));
        lblCpf.setText("CPF");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblNome)
                    .addComponent(lblNomeMae)
                    .addComponent(txtNomeMae, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblNomePai)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(lblNumeroCadastro)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtNumeroCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(txtNomePai, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblProfissao)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtDataNascimento, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtNacionalidade, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lblDataNascimento)
                            .addComponent(lblNacionalidade, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(cbEstadoCivil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(lblEstadoCivil)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtNaturalidade, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(lblNaturalidade, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
                    .addComponent(txtProfissao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtIdentidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblIdentidade, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblCpf)
                            .addComponent(txtCpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNumeroCadastro)
                    .addComponent(txtNumeroCadastro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblNome)
                .addGap(1, 1, 1)
                .addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblNomeMae)
                .addGap(1, 1, 1)
                .addComponent(txtNomeMae, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblNomePai)
                .addGap(1, 1, 1)
                .addComponent(txtNomePai, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblNaturalidade)
                    .addComponent(lblNacionalidade))
                .addGap(1, 1, 1)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtNacionalidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtNaturalidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDataNascimento)
                    .addComponent(lblEstadoCivil))
                .addGap(1, 1, 1)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cbEstadoCivil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtDataNascimento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(lblProfissao)
                .addGap(1, 1, 1)
                .addComponent(txtProfissao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblIdentidade)
                    .addComponent(lblCpf))
                .addGap(1, 1, 1)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtIdentidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtCpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pDados.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        pDados.setMinimumSize(new java.awt.Dimension(778, 338));
        pDados.setPreferredSize(new java.awt.Dimension(260, 426));

        txtMunicipio.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtMunicipio.setForeground(new java.awt.Color(51, 51, 51));
        txtMunicipio.setMinimumSize(new java.awt.Dimension(50, 18));
        txtMunicipio.setNextFocusableComponent(txtEstado);
        txtMunicipio.setPreferredSize(new java.awt.Dimension(50, 25));

        lblMunicipio.setForeground(new java.awt.Color(51, 51, 51));
        lblMunicipio.setText("Município");

        lblLogradouro.setForeground(new java.awt.Color(51, 51, 51));
        lblLogradouro.setText("Logradouro (Rua)");

        txtLogradouro.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtLogradouro.setForeground(new java.awt.Color(51, 51, 51));
        txtLogradouro.setMinimumSize(new java.awt.Dimension(240, 25));
        txtLogradouro.setNextFocusableComponent(txtNumero);
        txtLogradouro.setPreferredSize(new java.awt.Dimension(240, 25));

        lblNumero.setForeground(new java.awt.Color(51, 51, 51));
        lblNumero.setText("Número");

        txtNumero.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtNumero.setForeground(new java.awt.Color(51, 51, 51));
        txtNumero.setMinimumSize(new java.awt.Dimension(50, 18));
        txtNumero.setNextFocusableComponent(txtComplemento);
        txtNumero.setPreferredSize(new java.awt.Dimension(50, 25));

        txtComplemento.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtComplemento.setForeground(new java.awt.Color(51, 51, 51));
        txtComplemento.setMinimumSize(new java.awt.Dimension(50, 18));
        txtComplemento.setNextFocusableComponent(txtBairro);
        txtComplemento.setPreferredSize(new java.awt.Dimension(50, 25));

        lblComplemento.setForeground(new java.awt.Color(51, 51, 51));
        lblComplemento.setText("Complemento");

        txtBairro.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtBairro.setForeground(new java.awt.Color(51, 51, 51));
        txtBairro.setMaximumSize(new java.awt.Dimension(9999, 25));
        txtBairro.setMinimumSize(new java.awt.Dimension(50, 25));
        txtBairro.setNextFocusableComponent(txtMunicipio);
        txtBairro.setPreferredSize(new java.awt.Dimension(120, 25));

        lblBairro.setForeground(new java.awt.Color(51, 51, 51));
        lblBairro.setText("Bairro");

        txtEstado.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtEstado.setForeground(new java.awt.Color(51, 51, 51));
        txtEstado.setMinimumSize(new java.awt.Dimension(50, 25));
        txtEstado.setNextFocusableComponent(txtCep);
        txtEstado.setPreferredSize(new java.awt.Dimension(120, 25));

        lblEstado.setForeground(new java.awt.Color(51, 51, 51));
        lblEstado.setText("Estado");

        lblCep.setForeground(new java.awt.Color(51, 51, 51));
        lblCep.setText("CEP");

        txtCep.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtCep.setForeground(new java.awt.Color(51, 51, 51));
        txtCep.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtCep.setMaximumSize(new java.awt.Dimension(70, 23));
        txtCep.setMinimumSize(new java.awt.Dimension(50, 18));
        txtCep.setNextFocusableComponent(txtTelResidencia);
        txtCep.setPreferredSize(new java.awt.Dimension(50, 25));

        txtTelResidencia.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtTelResidencia.setForeground(new java.awt.Color(51, 51, 51));
        txtTelResidencia.setMinimumSize(new java.awt.Dimension(50, 18));
        txtTelResidencia.setNextFocusableComponent(txtTelCelular);
        txtTelResidencia.setPreferredSize(new java.awt.Dimension(79, 25));

        lblTelResidencia.setForeground(new java.awt.Color(51, 51, 51));
        lblTelResidencia.setText("Tel. Residência");

        txtTelCelular.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtTelCelular.setForeground(new java.awt.Color(51, 51, 51));
        txtTelCelular.setMinimumSize(new java.awt.Dimension(50, 18));
        txtTelCelular.setNextFocusableComponent(txtEmail);
        txtTelCelular.setPreferredSize(new java.awt.Dimension(79, 25));

        lblTelCelular.setForeground(new java.awt.Color(51, 51, 51));
        lblTelCelular.setText("Tel. Celular");

        lblEmail.setForeground(new java.awt.Color(51, 51, 51));
        lblEmail.setText("E-mail");

        txtEmail.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtEmail.setForeground(new java.awt.Color(51, 51, 51));
        txtEmail.setMaximumSize(new java.awt.Dimension(240, 25));
        txtEmail.setMinimumSize(new java.awt.Dimension(240, 25));
        txtEmail.setNextFocusableComponent(rbSim);
        txtEmail.setPreferredSize(new java.awt.Dimension(240, 25));

        lblBatizadoNasAguas.setForeground(new java.awt.Color(51, 51, 51));
        lblBatizadoNasAguas.setText("É Batizado nas Águas?");

        buttonGroup2.add(rbSim);
        rbSim.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        rbSim.setForeground(new java.awt.Color(51, 51, 51));
        rbSim.setText("Sim");
        rbSim.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        rbSim.setNextFocusableComponent(rbNao);
        rbSim.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
        rbSim.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbSimActionPerformed(evt);
            }
        });

        buttonGroup2.add(rbNao);
        rbNao.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        rbNao.setForeground(new java.awt.Color(51, 51, 51));
        rbNao.setSelected(true);
        rbNao.setText("Não");
        rbNao.setNextFocusableComponent(txtIgrejaBatismo);
        rbNao.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
        rbNao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbNaoActionPerformed(evt);
            }
        });

        lblIgrejaBatismo.setForeground(new java.awt.Color(51, 51, 51));
        lblIgrejaBatismo.setText("Igreja onde foi Batizado(a)");

        txtIgrejaBatismo.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtIgrejaBatismo.setForeground(new java.awt.Color(51, 51, 51));
        txtIgrejaBatismo.setMinimumSize(new java.awt.Dimension(50, 18));
        txtIgrejaBatismo.setNextFocusableComponent(txtDataBatismo);
        txtIgrejaBatismo.setPreferredSize(new java.awt.Dimension(240, 25));

        lblDataBatismo.setForeground(new java.awt.Color(51, 51, 51));
        lblDataBatismo.setText("Data de Batismo");

        txtDataBatismo.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtDataBatismo.setForeground(new java.awt.Color(51, 51, 51));
        txtDataBatismo.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtDataBatismo.setMaximumSize(new java.awt.Dimension(75, 25));
        txtDataBatismo.setMinimumSize(new java.awt.Dimension(75, 25));
        txtDataBatismo.setNextFocusableComponent(rbCargoMinisterialSim);
        txtDataBatismo.setPreferredSize(new java.awt.Dimension(75, 25));

        javax.swing.GroupLayout pDadosLayout = new javax.swing.GroupLayout(pDados);
        pDados.setLayout(pDadosLayout);
        pDadosLayout.setHorizontalGroup(
            pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pDadosLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblDataBatismo)
                    .addComponent(txtDataBatismo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblLogradouro)
                    .addComponent(txtLogradouro, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblIgrejaBatismo)
                    .addComponent(txtEmail, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblBatizadoNasAguas)
                    .addGroup(pDadosLayout.createSequentialGroup()
                        .addComponent(rbSim, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(rbNao))
                    .addGroup(pDadosLayout.createSequentialGroup()
                        .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(pDadosLayout.createSequentialGroup()
                                .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtNumero, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblNumero, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtComplemento, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblComplemento)))
                            .addComponent(lblMunicipio)
                            .addComponent(txtMunicipio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtBairro, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtEstado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblEstado)
                            .addComponent(lblBairro)))
                    .addGroup(pDadosLayout.createSequentialGroup()
                        .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblCep)
                            .addComponent(lblEmail)
                            .addComponent(txtCep, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lblTelResidencia, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtTelResidencia, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lblTelCelular, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtTelCelular, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(txtIgrejaBatismo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pDadosLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {txtTelCelular, txtTelResidencia});

        pDadosLayout.setVerticalGroup(
            pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pDadosLayout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addComponent(lblLogradouro)
                .addGap(1, 1, 1)
                .addComponent(txtLogradouro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pDadosLayout.createSequentialGroup()
                        .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pDadosLayout.createSequentialGroup()
                                .addComponent(lblNumero)
                                .addGap(1, 1, 1)
                                .addComponent(txtNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pDadosLayout.createSequentialGroup()
                                .addComponent(lblComplemento)
                                .addGap(1, 1, 1)
                                .addComponent(txtComplemento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lblMunicipio)
                        .addGap(1, 1, 1)
                        .addComponent(txtMunicipio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pDadosLayout.createSequentialGroup()
                        .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblBairro)
                            .addGroup(pDadosLayout.createSequentialGroup()
                                .addGap(15, 15, 15)
                                .addComponent(txtBairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lblEstado)
                        .addGap(1, 1, 1)
                        .addComponent(txtEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pDadosLayout.createSequentialGroup()
                        .addComponent(lblTelCelular)
                        .addGap(31, 31, 31)
                        .addComponent(lblEmail)
                        .addGap(0, 0, 0)
                        .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(pDadosLayout.createSequentialGroup()
                            .addComponent(lblCep)
                            .addGap(1, 1, 1)
                            .addComponent(txtCep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(pDadosLayout.createSequentialGroup()
                            .addComponent(lblTelResidencia)
                            .addGap(1, 1, 1)
                            .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(txtTelResidencia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(txtTelCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblBatizadoNasAguas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pDadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(rbSim)
                    .addComponent(rbNao))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblIgrejaBatismo)
                .addGap(0, 0, 0)
                .addComponent(txtIgrejaBatismo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblDataBatismo)
                .addGap(0, 0, 0)
                .addComponent(txtDataBatismo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(16, Short.MAX_VALUE))
        );

        jPanel2.setMaximumSize(new java.awt.Dimension(260, 426));
        jPanel2.setMinimumSize(new java.awt.Dimension(260, 426));
        jPanel2.setPreferredSize(new java.awt.Dimension(260, 426));

        lblCargoMinisterial.setForeground(new java.awt.Color(51, 51, 51));
        lblCargoMinisterial.setText("Possui algum cargo Ministerial na Igreja?");

        buttonGroup1.add(rbCargoMinisterialSim);
        rbCargoMinisterialSim.setForeground(new java.awt.Color(51, 51, 51));
        rbCargoMinisterialSim.setText("Sim");
        rbCargoMinisterialSim.setNextFocusableComponent(rbCargoMinisterialNao);
        rbCargoMinisterialSim.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbCargoMinisterialSimActionPerformed(evt);
            }
        });

        buttonGroup1.add(rbCargoMinisterialNao);
        rbCargoMinisterialNao.setForeground(new java.awt.Color(51, 51, 51));
        rbCargoMinisterialNao.setSelected(true);
        rbCargoMinisterialNao.setText("Não");
        rbCargoMinisterialNao.setNextFocusableComponent(txtIgrejaConsagracao);
        rbCargoMinisterialNao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbCargoMinisterialNaoActionPerformed(evt);
            }
        });

        lblIgrejaConsagracao.setForeground(new java.awt.Color(51, 51, 51));
        lblIgrejaConsagracao.setText("Igreja onde foi Consagrado(a)");

        txtIgrejaConsagracao.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtIgrejaConsagracao.setForeground(new java.awt.Color(51, 51, 51));
        txtIgrejaConsagracao.setMinimumSize(new java.awt.Dimension(50, 18));
        txtIgrejaConsagracao.setNextFocusableComponent(txtCargoUltimaConsagracao);
        txtIgrejaConsagracao.setPreferredSize(new java.awt.Dimension(240, 25));

        lblCargoUltimaConsagracao.setForeground(new java.awt.Color(51, 51, 51));
        lblCargoUltimaConsagracao.setText("Cargo ultima Consagração");

        txtCargoUltimaConsagracao.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtCargoUltimaConsagracao.setForeground(new java.awt.Color(51, 51, 51));
        txtCargoUltimaConsagracao.setMinimumSize(new java.awt.Dimension(50, 18));
        txtCargoUltimaConsagracao.setNextFocusableComponent(txtDataConsagracao);
        txtCargoUltimaConsagracao.setPreferredSize(new java.awt.Dimension(240, 25));

        lblDataConsagracao.setForeground(new java.awt.Color(51, 51, 51));
        lblDataConsagracao.setText("Data da Consagração");

        txtDataConsagracao.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtDataConsagracao.setForeground(new java.awt.Color(51, 51, 51));
        txtDataConsagracao.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtDataConsagracao.setMaximumSize(new java.awt.Dimension(75, 25));
        txtDataConsagracao.setMinimumSize(new java.awt.Dimension(75, 25));
        txtDataConsagracao.setNextFocusableComponent(txtDataIngresso);
        txtDataConsagracao.setPreferredSize(new java.awt.Dimension(75, 25));

        lblDataIngresso.setForeground(new java.awt.Color(51, 51, 51));
        lblDataIngresso.setText("Data de ingresso nesta Igreja");

        txtDataIngresso.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtDataIngresso.setForeground(new java.awt.Color(51, 51, 51));
        txtDataIngresso.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtDataIngresso.setMaximumSize(new java.awt.Dimension(75, 25));
        txtDataIngresso.setMinimumSize(new java.awt.Dimension(75, 25));
        txtDataIngresso.setNextFocusableComponent(txtCargoAtual);
        txtDataIngresso.setPreferredSize(new java.awt.Dimension(75, 25));

        lblCargoAtual.setForeground(new java.awt.Color(51, 51, 51));
        lblCargoAtual.setText("Cargo Atual");

        txtCargoAtual.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtCargoAtual.setForeground(new java.awt.Color(51, 51, 51));
        txtCargoAtual.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        txtCargoAtual.setMinimumSize(new java.awt.Dimension(50, 18));
        txtCargoAtual.setNextFocusableComponent(btSalvar);
        txtCargoAtual.setPreferredSize(new java.awt.Dimension(240, 25));

        lblIgrejas.setForeground(new java.awt.Color(51, 51, 51));
        lblIgrejas.setText("Igreja");

        cbIgrejas.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        cbIgrejas.setForeground(new java.awt.Color(51, 51, 51));
        cbIgrejas.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Selecione" }));
        cbIgrejas.setMaximumSize(new java.awt.Dimension(100, 25));
        cbIgrejas.setMinimumSize(new java.awt.Dimension(100, 25));
        cbIgrejas.setPreferredSize(new java.awt.Dimension(225, 25));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtCargoAtual, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtDataIngresso, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDataConsagracao)
                    .addComponent(txtDataConsagracao, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDataIngresso)
                    .addComponent(lblIgrejaConsagracao)
                    .addComponent(lblCargoUltimaConsagracao)
                    .addComponent(txtCargoUltimaConsagracao, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblCargoMinisterial, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(rbCargoMinisterialSim)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(rbCargoMinisterialNao))
                    .addComponent(txtIgrejaConsagracao, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblCargoAtual)
                    .addComponent(lblIgrejas)
                    .addComponent(cbIgrejas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblCargoMinisterial)
                .addGap(0, 0, 0)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(rbCargoMinisterialSim)
                    .addComponent(rbCargoMinisterialNao))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblIgrejaConsagracao)
                .addGap(0, 0, 0)
                .addComponent(txtIgrejaConsagracao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblCargoUltimaConsagracao)
                .addGap(0, 0, 0)
                .addComponent(txtCargoUltimaConsagracao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(16, 16, 16)
                        .addComponent(txtDataConsagracao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblDataIngresso))
                    .addComponent(lblDataConsagracao))
                .addComponent(txtDataIngresso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblCargoAtual)
                .addGap(2, 2, 2)
                .addComponent(txtCargoAtual, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblIgrejas)
                .addGap(1, 1, 1)
                .addComponent(cbIgrejas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        btCancelar.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        btCancelar.setForeground(new java.awt.Color(51, 51, 51));
        btCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scc/Imagens/cancelar.png"))); // NOI18N
        btCancelar.setText("Cancelar");
        btCancelar.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btCancelar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btCancelar.setIconTextGap(10);
        btCancelar.setMargin(new java.awt.Insets(2, 5, 2, 5));
        btCancelar.setNextFocusableComponent(this);
        btCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCancelarActionPerformed(evt);
            }
        });

        btSalvar.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        btSalvar.setForeground(new java.awt.Color(51, 51, 51));
        btSalvar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scc/Imagens/salvar.png"))); // NOI18N
        btSalvar.setText("Salvar");
        btSalvar.setEnabled(false);
        btSalvar.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btSalvar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btSalvar.setIconTextGap(10);
        btSalvar.setMargin(new java.awt.Insets(2, 5, 2, 5));
        btSalvar.setNextFocusableComponent(btCancelar);
        btSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btSalvarActionPerformed(evt);
            }
        });

        btNovoCadastro.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        btNovoCadastro.setForeground(new java.awt.Color(51, 51, 51));
        btNovoCadastro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scc/Imagens/novo.png"))); // NOI18N
        btNovoCadastro.setText("Novo Cadastro");
        btNovoCadastro.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btNovoCadastro.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btNovoCadastro.setIconTextGap(10);
        btNovoCadastro.setMargin(new java.awt.Insets(2, 5, 2, 5));
        btNovoCadastro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btNovoCadastroActionPerformed(evt);
            }
        });

        btAtualizar.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        btAtualizar.setForeground(new java.awt.Color(51, 51, 51));
        btAtualizar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scc/Imagens/atualizar.png"))); // NOI18N
        btAtualizar.setText("Atualizar");
        btAtualizar.setEnabled(false);
        btAtualizar.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btAtualizar.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btAtualizar.setIconTextGap(10);
        btAtualizar.setMargin(new java.awt.Insets(2, 5, 2, 5));
        btAtualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAtualizarActionPerformed(evt);
            }
        });

        jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel4.setMaximumSize(new java.awt.Dimension(113, 151));
        jPanel4.setMinimumSize(new java.awt.Dimension(113, 151));
        jPanel4.setName("");
        jPanel4.setPreferredSize(new java.awt.Dimension(113, 151));

        txtfoto.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        txtfoto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scc/Imagens/User.png"))); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(txtfoto)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(txtfoto)
        );

        btAlterarFoto.setFont(new java.awt.Font("Calibri", 0, 12)); // NOI18N
        btAlterarFoto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scc/Imagens/folder.png"))); // NOI18N
        btAlterarFoto.setText("Alterar Foto");
        btAlterarFoto.setEnabled(false);
        btAlterarFoto.setMaximumSize(new java.awt.Dimension(97, 30));
        btAlterarFoto.setMinimumSize(new java.awt.Dimension(97, 30));
        btAlterarFoto.setPreferredSize(new java.awt.Dimension(97, 30));
        btAlterarFoto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAlterarFotoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
                    .addComponent(btAlterarFoto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btAlterarFoto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(btNovoCadastro)
                            .addGap(18, 18, 18)
                            .addComponent(btAtualizar)
                            .addGap(295, 295, 295)
                            .addComponent(btSalvar)
                            .addGap(18, 18, 18)
                            .addComponent(btCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(0, 0, Short.MAX_VALUE))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(1, 1, 1)
                            .addComponent(pDados, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(1, 1, 1)
                            .addComponent(jPanel2, 246, 246, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(1, 1, 1)
                            .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap()))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(pPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(279, 279, 279))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pPesquisa, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pDados, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btNovoCadastro)
                    .addComponent(btAtualizar)
                    .addComponent(btSalvar)
                    .addComponent(btCancelar))
                .addGap(71, 71, 71))
        );

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {btAtualizar, btCancelar, btSalvar});

        setBounds(0, 0, 943, 630);
    }// </editor-fold>//GEN-END:initComponents

    private void btCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCancelarActionPerformed
        int pergunta=JOptionPane.showConfirmDialog(this, "Deseja realmente cancelar o cadastro?\n", "Confirmação", 2);
        if(pergunta==0){//clicou em sim
            setVisible(false);
            try {
                txtNumeroCadastro.setText(new Integer(dao.proximoNumeroCadastro()).toString());
            } catch (SQLException ex) {
                Logger.getLogger(FrmCadastrarMembros.class.getName()).log(Level.SEVERE, null, ex);
            }
            limpaCampos();
            habilitaCampos(false);
            retornaCorLabels();
            btAtualizar.setEnabled(false);
            btAlterarFoto.setEnabled(false);
            rbNao.setSelected(true);
            rbCargoMinisterialNao.setSelected(true);
        }
    }//GEN-LAST:event_btCancelarActionPerformed

    private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed
        try {
            retornaCorLabels();
            if (verificaCampoObrigatorioVazio()) {
                JOptionPane.showMessageDialog(this, "Favor preencher campo(s) obrigatório(s) em Vermelho!");
                return;
            }
            Membro membro = new Membro();
            membro.setNome(txtNome.getText());
            membro.setNacionalidade(txtNacionalidade.getText());
            membro.setNaturalidade(txtNaturalidade.getText());
            membro.setNome_mae(txtNomeMae.getText());
            membro.setNome_pai(txtNomePai.getText());
            membro.setProfissao(txtProfissao.getText());
            membro.setEstado_civil(cbEstadoCivil.getSelectedItem().toString());
            membro.setData_nascimento(new SimpleDateFormat("dd/MM/yyyy").parse(txtDataNascimento.getText()));
            membro.setData_ingresso(new SimpleDateFormat("dd/MM/yyyy").parse(txtDataIngresso.getText()));
            if (rbSim.isSelected()) membro.setData_batismo(new SimpleDateFormat("dd/MM/yyyy").parse(txtDataBatismo.getText()));
            if (rbCargoMinisterialSim.isSelected()) membro.setData_consagracao(new SimpleDateFormat("dd/MM/yyyy").parse(txtDataConsagracao.getText()));
            membro.setData_cadastro(new Date());
            if (rbSim.isSelected()) membro.setIgreja_batismo(txtIgrejaBatismo.getText());
            if (rbCargoMinisterialSim.isSelected()) membro.setIgreja_consagracao(txtIgrejaConsagracao.getText());
            if (rbCargoMinisterialSim.isSelected()) membro.setCargo_ultima_igreja(txtCargoUltimaConsagracao.getText());
            membro.setCargo_atual(txtCargoAtual.getText());
            membro.setLogradouro(txtLogradouro.getText());
            membro.setBairro(txtBairro.getText());
            membro.setMunicipio(txtMunicipio.getText());
            membro.setEstado(txtEstado.getText());
            membro.setNumero(txtNumero.getText());
            membro.setComplemento(txtComplemento.getText());
            membro.setCep(txtCep.getText());
            membro.setIdentidade(txtIdentidade.getText());
            membro.setCpf(txtCpf.getText());
            membro.setTelefone_residencial(txtTelResidencia.getText());
            membro.setTelefone_celular(txtTelCelular.getText());
            membro.setEmail(txtEmail.getText());                
            membro.setIdIgreja(cbIgrejas.getSelectedIndex());
            
            dao.cadastrarMembro(membro);
            gravarFoto();
            JOptionPane.showMessageDialog(this, "Cadastro Salvo com sucesso!");
            
            carregarListaMembros();
            
            limpaCampos();
            habilitaCampos(false);
            btSalvar.setEnabled(false);
            btAlterarFoto.setEnabled(false);            
        } catch (ParseException ex) {
            Logger.getLogger(FrmCadastrarMembros.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(FrmCadastrarMembros.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }//GEN-LAST:event_btSalvarActionPerformed

    private void rbNaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbNaoActionPerformed
        txtIgrejaBatismo.setEnabled(false);
        txtDataBatismo.setEnabled(false);
        txtDataBatismo.setText("");
    }//GEN-LAST:event_rbNaoActionPerformed

    private void rbSimActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbSimActionPerformed
        txtIgrejaBatismo.setEnabled(true);
        txtDataBatismo.setEnabled(true);
    }//GEN-LAST:event_rbSimActionPerformed

    private void rbCargoMinisterialSimActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbCargoMinisterialSimActionPerformed
        txtIgrejaConsagracao.setEnabled(true);
        txtCargoUltimaConsagracao.setEnabled(true);
        txtDataConsagracao.setEnabled(true);
        txtCargoAtual.setEnabled(true);
    }//GEN-LAST:event_rbCargoMinisterialSimActionPerformed

    private void rbCargoMinisterialNaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbCargoMinisterialNaoActionPerformed
        txtIgrejaConsagracao.setEnabled(false);
        txtCargoUltimaConsagracao.setEnabled(false);
        txtDataConsagracao.setEnabled(false);
        txtCargoAtual.setEnabled(false);
        txtIgrejaConsagracao.setText("");
        txtCargoUltimaConsagracao.setText("");
        txtCargoAtual.setText("");
        txtDataConsagracao.setText("");
        
    }//GEN-LAST:event_rbCargoMinisterialNaoActionPerformed

    private void btNovoCadastroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btNovoCadastroActionPerformed
        
        int resposta = JOptionPane.showConfirmDialog(this, "Deseja criar um novo Cadastro?", "Novo Cadastro", 0);
        
        if (resposta == 0) {
            try {
                limpaCampos();
                txtNumeroCadastro.setText(new Integer(dao.proximoNumeroCadastro()).toString());
                retornaCorLabels();
                habilitaCampos(true);
                btSalvar.setEnabled(true);
                btEditar.setEnabled(false);
                btAlterarFoto.setEnabled(true);
            } catch (SQLException ex) {
                Logger.getLogger(FrmCadastrarMembros.class.getName()).log(Level.SEVERE, null, ex);
            }
        }        
    }//GEN-LAST:event_btNovoCadastroActionPerformed

    private void btConsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btConsultarActionPerformed
                       
        if (cbCadastro.getSelectedItem().equals("Selecione")) {
            JOptionPane.showMessageDialog(this, "Selecione um Item!");
            return;
        }
        
        if (!txtNumeroCadastro.getText().equals("")) {
            int resposta = JOptionPane.showConfirmDialog(this, "Os dados do formulário serão perdidos!", "Consultar Cadastro", 2);
            if (resposta == 0){                
                btSalvar.setEnabled(false);
                retornaCorLabels();
                limpaCampos();
                String numeroCadastro = cbCadastro.getSelectedItem().toString();        
                int id = new Integer(numeroCadastro.substring(0, 3));        
                try {
                    Membro membro = dao.consultarMembro(id);
                    txtNumeroCadastro.setText(new Integer(membro.getId()).toString());
                    txtNome.setText(membro.getNome());
                    txtNomeMae.setText(membro.getNome_mae());
                    txtNomePai.setText(membro.getNome_pai());
                    txtNacionalidade.setText(membro.getNacionalidade());
                    txtNaturalidade.setText(membro.getNaturalidade());
                    txtBairro.setText(membro.getBairro());                    
                    txtCep.setText(membro.getCep());
                    txtComplemento.setText(membro.getComplemento());
                    txtCpf.setText(membro.getCpf());                    
                    if(membro.getData_batismo() != null) {
                        txtDataBatismo.setText(new SimpleDateFormat("dd/MM/yyyy").format(membro.getData_batismo()));
                        txtIgrejaBatismo.setText(membro.getIgreja_batismo());
                        rbSim.setSelected(true);
                        txtDataBatismo.setEnabled(true);
                        txtIgrejaBatismo.setEnabled(true);
                    } else {
                        rbNao.setSelected(true);
                    }                    
                    if(membro.getData_consagracao() != null) {
                        txtDataConsagracao.setText(new SimpleDateFormat("dd/MM/yyyy").format(membro.getData_consagracao()));
                        txtIgrejaConsagracao.setText(membro.getIgreja_consagracao());
                        txtCargoUltimaConsagracao.setText(membro.getCargo_ultima_igreja());
                        txtCargoAtual.setText(membro.getCargo_atual());
                        rbCargoMinisterialSim.setSelected(true);
                        txtDataConsagracao.setEnabled(true);
                        txtIgrejaConsagracao.setEnabled(true);
                        txtCargoUltimaConsagracao.setEnabled(true);
                        txtCargoAtual.setEnabled(true);
                    } else {
                        rbCargoMinisterialNao.setSelected(true);
                    }
                    txtDataIngresso.setText(new SimpleDateFormat("dd/MM/yyyy").format(membro.getData_ingresso()));
                    txtDataNascimento.setText(new SimpleDateFormat("dd/MM/yyyy").format(membro.getData_nascimento()));
                    txtEmail.setText(membro.getEmail());
                    txtEstado.setText(membro.getEstado());
                    cbEstadoCivil.setSelectedItem(membro.getEstado_civil());
                    txtIdentidade.setText(membro.getIdentidade());                                        
                    txtLogradouro.setText(membro.getLogradouro());
                    txtMunicipio.setText(membro.getMunicipio());
                    txtNumero.setText(membro.getNumero());        
                    txtProfissao.setText(membro.getProfissao());
                    txtTelCelular.setText(membro.getTelefone_celular());
                    txtTelResidencia.setText(membro.getTelefone_residencial());
                    cbIgrejas.setSelectedIndex(membro.getIdIgreja());
                    carregarFoto(Integer.parseInt(txtNumeroCadastro.getText()));
                    btEditar.setEnabled(true);
                    habilitaCampos(false);                    
                } catch (SQLException ex) {
                    Logger.getLogger(FrmCadastrarMembros.class.getName()).log(Level.SEVERE, null, ex);
                }                                
            }
        } else {            
            btSalvar.setEnabled(false);
            retornaCorLabels();
            limpaCampos();
            String numeroCadastro = cbCadastro.getSelectedItem().toString();        
            int id = new Integer(numeroCadastro.substring(0, 3));        
            try {
                Membro membro = dao.consultarMembro(id);
                txtNumeroCadastro.setText(new Integer(membro.getId()).toString());
                txtNome.setText(membro.getNome());
                txtNomeMae.setText(membro.getNome_mae());
                txtNomePai.setText(membro.getNome_pai());
                txtNacionalidade.setText(membro.getNacionalidade());
                txtNaturalidade.setText(membro.getNaturalidade());
                txtBairro.setText(membro.getBairro());                    
                txtCep.setText(membro.getCep());
                txtComplemento.setText(membro.getComplemento());
                txtCpf.setText(membro.getCpf());                    
                if(membro.getData_batismo() != null) {
                    txtDataBatismo.setText(new SimpleDateFormat("dd/MM/yyyy").format(membro.getData_batismo()));
                    txtIgrejaBatismo.setText(membro.getIgreja_batismo());
                    rbSim.setSelected(true);
                    txtDataBatismo.setEnabled(true);
                    txtIgrejaBatismo.setEnabled(true);
                } else {
                    rbNao.setSelected(true);
                }                    
                if(membro.getData_consagracao() != null) {
                    txtDataConsagracao.setText(new SimpleDateFormat("dd/MM/yyyy").format(membro.getData_consagracao()));
                    txtIgrejaConsagracao.setText(membro.getIgreja_consagracao());
                    txtCargoUltimaConsagracao.setText(membro.getCargo_ultima_igreja());
                    txtCargoAtual.setText(membro.getCargo_atual());
                    rbCargoMinisterialSim.setSelected(true);
                    txtDataConsagracao.setEnabled(true);
                    txtIgrejaConsagracao.setEnabled(true);
                    txtCargoUltimaConsagracao.setEnabled(true);
                    txtCargoAtual.setEnabled(true);
                } else {
                    rbCargoMinisterialNao.setSelected(true);
                }
                txtDataIngresso.setText(new SimpleDateFormat("dd/MM/yyyy").format(membro.getData_ingresso()));
                txtDataNascimento.setText(new SimpleDateFormat("dd/MM/yyyy").format(membro.getData_nascimento()));
                txtEmail.setText(membro.getEmail());
                txtEstado.setText(membro.getEstado());
                cbEstadoCivil.setSelectedItem(membro.getEstado_civil());
                txtIdentidade.setText(membro.getIdentidade());                                        
                txtLogradouro.setText(membro.getLogradouro());
                txtMunicipio.setText(membro.getMunicipio());
                txtNumero.setText(membro.getNumero());        
                txtProfissao.setText(membro.getProfissao());
                txtTelCelular.setText(membro.getTelefone_celular());
                txtTelResidencia.setText(membro.getTelefone_residencial());
                cbIgrejas.setSelectedIndex(membro.getIdIgreja());
                carregarFoto(Integer.parseInt(txtNumeroCadastro.getText()));
                btEditar.setEnabled(true);
                habilitaCampos(false);
            } catch (SQLException ex) {
            Logger.getLogger(FrmCadastrarMembros.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        
    }//GEN-LAST:event_btConsultarActionPerformed

    private void btAtualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAtualizarActionPerformed
        retornaCorLabels();
        if (verificaCampoObrigatorioVazio()) {
            JOptionPane.showMessageDialog(this, "Favor preencher campo(s) obrigatório(s) em Vermelho!");
            return;
        }
        Membro membro = new Membro();
        
        membro.setId(new Integer(txtNumeroCadastro.getText()));
        membro.setNome(txtNome.getText());
        membro.setNacionalidade(txtNacionalidade.getText());
        membro.setNaturalidade(txtNaturalidade.getText());
        membro.setNome_mae(txtNomeMae.getText());
        membro.setNome_pai(txtNomePai.getText());
        membro.setProfissao(txtProfissao.getText());
        membro.setEstado_civil(cbEstadoCivil.getSelectedItem().toString());
        try {
            membro.setData_nascimento(new SimpleDateFormat("dd/MM/yyyy").parse(txtDataNascimento.getText()));
            membro.setData_ingresso(new SimpleDateFormat("dd/MM/yyyy").parse(txtDataIngresso.getText()));
            if (rbSim.isSelected()) membro.setData_batismo(new SimpleDateFormat("dd/MM/yyyy").parse(txtDataBatismo.getText()));
            if (rbCargoMinisterialSim.isSelected()) membro.setData_consagracao(new SimpleDateFormat("dd/MM/yyyy").parse(txtDataConsagracao.getText()));
        } catch (ParseException ex) {
            Logger.getLogger(FrmCadastrarMembros.class.getName()).log(Level.SEVERE, null, ex);
        }        
        membro.setData_cadastro(new Date());
        if (rbSim.isSelected()) membro.setIgreja_batismo(txtIgrejaBatismo.getText());
        if (rbCargoMinisterialSim.isSelected()) membro.setIgreja_consagracao(txtIgrejaConsagracao.getText());
        if (rbCargoMinisterialSim.isSelected()) membro.setCargo_ultima_igreja(txtCargoUltimaConsagracao.getText());
        membro.setCargo_atual(txtCargoAtual.getText());
        membro.setLogradouro(txtLogradouro.getText());
        membro.setBairro(txtBairro.getText());
        membro.setMunicipio(txtMunicipio.getText());
        membro.setEstado(txtEstado.getText());
        membro.setNumero(txtNumero.getText());
        membro.setComplemento(txtComplemento.getText());
        membro.setCep(txtCep.getText());
        membro.setIdentidade(txtIdentidade.getText());
        membro.setCpf(txtCpf.getText());
        membro.setTelefone_residencial(txtTelResidencia.getText());
        membro.setTelefone_celular(txtTelCelular.getText());
        membro.setEmail(txtEmail.getText());                
        membro.setIdIgreja(cbIgrejas.getSelectedIndex());
        
        dao.atualizarMembro(membro);        
        gravarFoto();
        JOptionPane.showMessageDialog(this, "Cadastro Atualizado com sucesso!");
        limpaCampos();
        habilitaCampos(false);
        btEditar.setEnabled(false);
        btAtualizar.setEnabled(false);
        btAlterarFoto.setEnabled(false);        
        try {
            carregarListaMembros();
        } catch (SQLException ex) {
            Logger.getLogger(FrmCadastrarMembros.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btAtualizarActionPerformed

    private void btEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btEditarActionPerformed
        habilitaCampos(true);
        btAtualizar.setEnabled(true);
        btEditar.setEnabled(false);
        btAlterarFoto.setEnabled(true);
    }//GEN-LAST:event_btEditarActionPerformed

    private void txtCpfFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCpfFocusLost
        String cpf = txtCpf.getText();
        cpf = cpf.replace(".", "");
        cpf = cpf.replace("-", "");        
        if (!ValidaCPF.isCPF(cpf)) {            
            txtCpf.setText("");
            //txtCpf.requestFocus();
            JOptionPane.showMessageDialog(this, "CPF Inválido!: " + ValidaCPF.imprimeCPF(cpf));
        }
    }//GEN-LAST:event_txtCpfFocusLost

    private void carregarFoto(int numeroCadastro){
        File fileFoto = new File("Imagens\\Fotos\\" + numeroCadastro + ".jpg");
        if (fileFoto.exists()) {
            txtfoto.setIcon(new ImageIcon(fileFoto.getAbsolutePath()));
        } else {
            txtfoto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scc/Imagens/User.png")));
        }
    }
    
    
    private void btAlterarFotoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAlterarFotoActionPerformed
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(new FileNameExtensionFilter("Imagens JPG", "JPG"));
        fc.setAcceptAllFileFilterUsed(false);
        
        if(fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION){
            //Aprovado
            fileOrigem = fc.getSelectedFile();            
            txtfoto.setIcon(new ImageIcon(fileOrigem.getAbsolutePath()));            
        } else {
            //Cancelado
        }

    }//GEN-LAST:event_btAlterarFotoActionPerformed
    
    private void gravarFoto(){
        
        if(fileOrigem == null) return;
        int nc = Integer.parseInt(txtNumeroCadastro.getText());
        File fileDestino = new File("Imagens\\Fotos\\" + nc + ".jpg");
        
        String usuario_so = System.getProperty("user.name");
        String info = "O usuário atual do Windows \"" + usuario_so + "\" não possui permissão para salvar na pasta abaixo.\n" + fileDestino.getAbsolutePath().replace(fileDestino.getName(), "");
        if (!fileDestino.canWrite()) {
            JOptionPane.showMessageDialog(null, info);
            return;
        }
        
        try {
            copiar(fileOrigem, fileDestino);
        } catch (IOException ex) {
            Logger.getLogger(FrmCadastrarMembros.class.getName()).log(Level.SEVERE, null, ex);
            JOptionPane.showMessageDialog(this.getParent(), "Erro: " + ex.toString());
        }
    }
    
    private static void copiar(File origem, File destino) throws IOException {
        InputStream entrada = new FileInputStream(origem);
        OutputStream saida = new FileOutputStream(destino);

        // Tranferindo bytes da entrada para a saída
        byte[] buf = new byte[1024];
        int tamanho;
        while ((tamanho = entrada.read(buf)) > 0) {
            saida.write(buf, 0, tamanho);
        }
        entrada.close();
        saida.close();
    }      
    
    private boolean verificaCampoObrigatorioVazio(){
        boolean campoVazio = false;        
        if (txtNome.getText().equals("")){lblNome.setForeground(Color.red); campoVazio = true;}
        if (txtNacionalidade.getText().equals("")) {lblNacionalidade.setForeground(Color.red); campoVazio = true;}
        if (txtNaturalidade.getText().equals("")) {lblNaturalidade.setForeground(Color.red); campoVazio = true;}
        if (txtNomeMae.getText().equals("")) {lblNomeMae.setForeground(Color.red); campoVazio = true;}
        if (txtNomePai.getText().equals("")) {lblNomePai.setForeground(Color.red); campoVazio = true;}
        if (txtProfissao.getText().equals("")) {lblProfissao.setForeground(Color.red); campoVazio = true;}
        if (cbEstadoCivil.getSelectedIndex() == 0) {lblEstadoCivil.setForeground(Color.red); campoVazio = true;}
        if (txtDataNascimento.getText().equals("")) {lblDataNascimento.setForeground(Color.red); campoVazio = true;}
        if (txtLogradouro.getText().equals("")) {lblLogradouro.setForeground(Color.red); campoVazio = true;}
        if (txtNumero.getText().equals("")) {lblNumero.setForeground(Color.red); campoVazio = true;}
        if (txtComplemento.getText().equals("")) {lblComplemento.setForeground(Color.red); campoVazio = true;}
        if (txtBairro.getText().equals("")) {lblBairro.setForeground(Color.red); campoVazio = true;}
        if (txtMunicipio.getText().equals("")) {lblMunicipio.setForeground(Color.red); campoVazio = true;}
        if (txtEstado.getText().equals("")) {lblEstado.setForeground(Color.red); campoVazio = true;}
        if (txtCep.getText().equals("")) {lblCep.setForeground(Color.red); campoVazio = true;}
        if (txtTelResidencia.getText().equals("")) {lblTelResidencia.setForeground(Color.red); campoVazio = true;}
        if (txtTelCelular.getText().equals("")) {lblTelCelular.setForeground(Color.red); campoVazio = true;}
        if (txtIgrejaBatismo.getText().equals("") && rbSim.isSelected()) {lblIgrejaBatismo.setForeground(Color.red); campoVazio = true;}
        if (txtIgrejaConsagracao.getText().equals("") && rbCargoMinisterialSim.isSelected()) {lblIgrejaConsagracao.setForeground(Color.red); campoVazio = true;}
        if (txtCargoUltimaConsagracao.getText().equals("") && rbCargoMinisterialSim.isSelected()) {lblCargoUltimaConsagracao.setForeground(Color.red); campoVazio = true;}
        if (txtDataIngresso.getText().equals("  /  /    ")) {lblDataIngresso.setForeground(Color.red); campoVazio = true;}
        if (txtDataNascimento.getText().equals("  /  /    ")) {lblDataNascimento.setForeground(Color.red); campoVazio = true;}
        if (txtCargoAtual.getText().equals("") && rbCargoMinisterialSim.isSelected()) {lblCargoAtual.setForeground(Color.red); campoVazio = true;}        
        if (cbIgrejas.getSelectedIndex() == 0) {lblIgrejas.setForeground(Color.red); campoVazio = true;}
        return campoVazio;
    }
    
    private void retornaCorLabels(){
        lblNome.setForeground(new Color(51,51,51));
        lblNacionalidade.setForeground(new Color(51,51,51));
        lblNaturalidade.setForeground(new Color(51,51,51));
        lblNomeMae.setForeground(new Color(51,51,51));
        lblNomePai.setForeground(new Color(51,51,51));
        lblProfissao.setForeground(new Color(51,51,51));
        lblEstadoCivil.setForeground(new Color(51,51,51));
        lblDataNascimento.setForeground(new Color(51,51,51));
        lblLogradouro.setForeground(new Color(51,51,51));
        lblNumero.setForeground(new Color(51,51,51));
        lblComplemento.setForeground(new Color(51,51,51));
        lblBairro.setForeground(new Color(51,51,51));
        lblMunicipio.setForeground(new Color(51,51,51));
        lblEstado.setForeground(new Color(51,51,51));
        lblCep.setForeground(new Color(51,51,51));
        lblTelResidencia.setForeground(new Color(51,51,51));
        lblTelCelular.setForeground(new Color(51,51,51));
        lblIgrejaBatismo.setForeground(new Color(51,51,51));
        lblIgrejaConsagracao.setForeground(new Color(51,51,51));
        lblCargoUltimaConsagracao.setForeground(new Color(51,51,51));
        lblDataIngresso.setForeground(new Color(51,51,51));
        lblCargoAtual.setForeground(new Color(51,51,51));
        lblIgrejas.setForeground(new Color(51,51,51));
    }
    
    private void carregarListaMembros() throws SQLException{
        cbCadastro.removeAllItems();
        List<Membro> lista = dao.carregarListaMembros();
        Iterator<Membro> it = lista.iterator();
        NumberFormat nf = NumberFormat.getInstance();        
        nf.setMinimumIntegerDigits(3);
        while (it.hasNext()) {
            Membro membro = it.next();            
            String item = nf.format(membro.getId())+"   "+membro.getNome();
            cbCadastro.addItem(item);
        }
    }
 
    private void carregarListaIgrejas() throws SQLException{
        cbIgrejas.removeAllItems();
        cbIgrejas.addItem("Selecione");
        List<String> lista = dao.carregarListaIgrejas();
        Iterator<String> it = lista.iterator();                
        while (it.hasNext()) {
            String nome = it.next();
            cbIgrejas.addItem(nome);
        }
    }
    
    private void limpaCampos(){
        txtNumeroCadastro.setText("");
        txtBairro.setText("");
        txtCargoAtual.setText("");
        txtCargoUltimaConsagracao.setText("");
        txtCep.setText("");
        txtComplemento.setText("");
        txtCpf.setText("");
        txtDataBatismo.setText("");
        txtDataConsagracao.setText("");
        txtDataIngresso.setText("");
        txtDataNascimento.setText("");
        txtEmail.setText("");
        txtEstado.setText("");
        txtIdentidade.setText("");
        txtIgrejaBatismo.setText("");
        txtIgrejaConsagracao.setText("");
        txtLogradouro.setText("");
        txtMunicipio.setText("");
        txtNacionalidade.setText("");
        txtNaturalidade.setText("");
        txtNome.setText("");
        txtNomeMae.setText("");
        txtNomePai.setText("");
        txtNumero.setText("");        
        txtProfissao.setText("");
        txtTelCelular.setText("");
        txtTelResidencia.setText("");
        txtNome.requestFocus();
        cbEstadoCivil.setSelectedItem("Selecione");
        txtfoto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/scc/Imagens/User.png")));
        cbIgrejas.setSelectedItem("Selecione");
    }
    
    private void habilitaCampos(boolean booleano){
        if (booleano) {
            txtBairro.setEnabled(true);                 
            txtCep.setEnabled(true);
            txtComplemento.setEnabled(true);
            txtCpf.setEnabled(true);                        
            txtDataIngresso.setEnabled(true);
            txtDataNascimento.setEnabled(true);
            txtEmail.setEnabled(true);
            txtEstado.setEnabled(true);
            txtIdentidade.setEnabled(true);            
            txtLogradouro.setEnabled(true);
            txtMunicipio.setEnabled(true);
            txtNacionalidade.setEnabled(true);
            txtNaturalidade.setEnabled(true);
            txtNome.setEnabled(true);
            txtNomeMae.setEnabled(true);
            txtNomePai.setEnabled(true);
            txtNumero.setEnabled(true);
            txtProfissao.setEnabled(true);
            txtTelCelular.setEnabled(true);
            txtTelResidencia.setEnabled(true);            
            cbEstadoCivil.setEnabled(true);            
            rbSim.setEnabled(true);
            rbNao.setEnabled(true);
            rbCargoMinisterialSim.setEnabled(true);
            rbCargoMinisterialNao.setEnabled(true);
            if (rbSim.isSelected()) {
                txtDataBatismo.setEnabled(true);
                txtIgrejaBatismo.setEnabled(true);                
            }
            if (rbCargoMinisterialSim.isSelected()) {
                txtDataConsagracao.setEnabled(true);
                txtIgrejaConsagracao.setEnabled(true);
                txtCargoUltimaConsagracao.setEnabled(true);
                txtCargoAtual.setEnabled(true);
            }
            cbIgrejas.setEnabled(true);
            
        } else {
            txtBairro.setEnabled(false);
            txtCargoAtual.setEnabled(false);
            txtCargoUltimaConsagracao.setEnabled(false);
            txtCep.setEnabled(false);
            txtComplemento.setEnabled(false);
            txtCpf.setEnabled(false);
            txtDataBatismo.setEnabled(false);
            txtDataConsagracao.setEnabled(false);
            txtDataIngresso.setEnabled(false);
            txtDataNascimento.setEnabled(false);
            txtEmail.setEnabled(false);
            txtEstado.setEnabled(false);
            txtIdentidade.setEnabled(false);
            txtIgrejaBatismo.setEnabled(false);
            txtIgrejaConsagracao.setEnabled(false);
            txtLogradouro.setEnabled(false);
            txtMunicipio.setEnabled(false);
            txtNacionalidade.setEnabled(false);
            txtNaturalidade.setEnabled(false);
            txtNome.setEnabled(false);
            txtNomeMae.setEnabled(false);
            txtNomePai.setEnabled(false);
            txtNumero.setEnabled(false);
            txtProfissao.setEnabled(false);
            txtTelCelular.setEnabled(false);
            txtTelResidencia.setEnabled(false);            
            cbEstadoCivil.setEnabled(false);            
            rbSim.setEnabled(false);
            rbNao.setEnabled(false);
            rbCargoMinisterialSim.setEnabled(false);
            rbCargoMinisterialNao.setEnabled(false);
            cbIgrejas.setEnabled(false);
        }
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btAlterarFoto;
    private javax.swing.JButton btAtualizar;
    private javax.swing.JButton btCancelar;
    private javax.swing.JButton btConsultar;
    private javax.swing.JButton btEditar;
    private javax.swing.JButton btNovoCadastro;
    private javax.swing.JButton btSalvar;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JComboBox cbCadastro;
    private javax.swing.JComboBox cbEstadoCivil;
    private javax.swing.JComboBox cbIgrejas;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JLabel lblBairro;
    private javax.swing.JLabel lblBatizadoNasAguas;
    private javax.swing.JLabel lblCargoAtual;
    private javax.swing.JLabel lblCargoMinisterial;
    private javax.swing.JLabel lblCargoUltimaConsagracao;
    private javax.swing.JLabel lblCep;
    private javax.swing.JLabel lblComplemento;
    private javax.swing.JLabel lblCpf;
    private javax.swing.JLabel lblDataBatismo;
    private javax.swing.JLabel lblDataConsagracao;
    private javax.swing.JLabel lblDataIngresso;
    private javax.swing.JLabel lblDataNascimento;
    private javax.swing.JLabel lblEmail;
    private javax.swing.JLabel lblEstado;
    private javax.swing.JLabel lblEstadoCivil;
    private javax.swing.JLabel lblIdentidade;
    private javax.swing.JLabel lblIgrejaBatismo;
    private javax.swing.JLabel lblIgrejaConsagracao;
    private javax.swing.JLabel lblIgrejas;
    private javax.swing.JLabel lblLogradouro;
    private javax.swing.JLabel lblMunicipio;
    private javax.swing.JLabel lblNacionalidade;
    private javax.swing.JLabel lblNaturalidade;
    private javax.swing.JLabel lblNome;
    private javax.swing.JLabel lblNomeMae;
    private javax.swing.JLabel lblNomePai;
    private javax.swing.JLabel lblNumero;
    private javax.swing.JLabel lblNumeroCadastro;
    private javax.swing.JLabel lblPesquisaCadastro;
    private javax.swing.JLabel lblProfissao;
    private javax.swing.JLabel lblTelCelular;
    private javax.swing.JLabel lblTelResidencia;
    private javax.swing.JPanel pDados;
    private javax.swing.JPanel pPesquisa;
    private javax.swing.JRadioButton rbCargoMinisterialNao;
    private javax.swing.JRadioButton rbCargoMinisterialSim;
    private javax.swing.JRadioButton rbNao;
    private javax.swing.JRadioButton rbSim;
    private javax.swing.JTextField txtBairro;
    private javax.swing.JTextField txtCargoAtual;
    private javax.swing.JTextField txtCargoUltimaConsagracao;
    private javax.swing.JTextField txtCep;
    private javax.swing.JTextField txtComplemento;
    private javax.swing.JTextField txtCpf;
    private javax.swing.JTextField txtDataBatismo;
    private javax.swing.JTextField txtDataConsagracao;
    private javax.swing.JTextField txtDataIngresso;
    private javax.swing.JTextField txtDataNascimento;
    private javax.swing.JTextField txtEmail;
    private javax.swing.JTextField txtEstado;
    private javax.swing.JTextField txtIdentidade;
    private javax.swing.JTextField txtIgrejaBatismo;
    private javax.swing.JTextField txtIgrejaConsagracao;
    private javax.swing.JTextField txtLogradouro;
    private javax.swing.JTextField txtMunicipio;
    private javax.swing.JTextField txtNacionalidade;
    private javax.swing.JTextField txtNaturalidade;
    private javax.swing.JTextField txtNome;
    private javax.swing.JTextField txtNomeMae;
    private javax.swing.JTextField txtNomePai;
    private javax.swing.JTextField txtNumero;
    private javax.swing.JTextField txtNumeroCadastro;
    private javax.swing.JTextField txtProfissao;
    private javax.swing.JTextField txtTelCelular;
    private javax.swing.JTextField txtTelResidencia;
    private javax.swing.JLabel txtfoto;
    // End of variables declaration//GEN-END:variables
}
